package com.lujianfei.androidthread;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.lujianfei.androidthread.threadsActivity.AsyncTaskActivity;
import com.lujianfei.androidthread.threadsActivity.HandlerActivity;
import com.lujianfei.androidthread.threadsActivity.HandlerThreadActivity;
import com.lujianfei.androidthread.threadsActivity.RxJavaActivity;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.handler).setOnClickListener(this);
        findViewById(R.id.asycnTask).setOnClickListener(this);
        findViewById(R.id.handlerThread).setOnClickListener(this);
        findViewById(R.id.rxJava).setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        Intent intent = new Intent();
        switch (view.getId()) {
            case R.id.handler:{
                intent.setClass(this, HandlerActivity.class);
            }
            break;
            case R.id.asycnTask:{
                intent.setClass(this, AsyncTaskActivity.class);
            }
            break;
            case R.id.handlerThread:{
                intent.setClass(this, HandlerThreadActivity.class);
            }
            break;
            case R.id.rxJava:{
                intent.setClass(this, RxJavaActivity.class);
            }
            break;
        }
        startActivity(intent);
    }
}
